package com.ruoyi.app.controller;

import com.ruoyi.app.interceptor.SessionUtil;
import com.ruoyi.cms.domain.CrmMember;
import com.ruoyi.cms.domain.SysFeedback;
import com.ruoyi.cms.service.ISysFeedbackService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.employee.domain.CrmEmployee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author hct
 * @date 2022-10-05
 */
@RestController
@RequestMapping("/app/feedback")
public class AppFeedbackController extends BaseController
{
    @Autowired
    private ISysFeedbackService sysFeedbackService;

    @GetMapping("/list")
    public TableDataInfo list(SysFeedback sysFeedback)
    {
        startPage();
        List<SysFeedback> list = sysFeedbackService.selectSysFeedbackList(sysFeedback);
        return getDataTable(list);
    }

    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysFeedbackService.selectSysFeedbackById(id));
    }

    @PostMapping("add")
    public AjaxResult add( SysFeedback sysFeedback)
    {
        CrmMember crmEmployee=SessionUtil.getLoginUser();
        sysFeedback.setMemberId(crmEmployee.getId());
        return toAjax(sysFeedbackService.insertSysFeedback(sysFeedback));
    }

}
